<template>
<div class="vue-box sbot">
  <!-- 参数栏 -->
  <div class="c-panel">
    <!-- 提示 -->
    <div class="alert-span">
      <span>共同建设文明社区，感谢您的反馈！</span>
    </div>
    <el-form class="face-back">
      <!-- 表单 -->
      <sa-item v-model="m.source" type="enum" jtype="1" :jv="dims.SCS_SOURCES_TYPE" name="反馈来源" br />
      <sa-item v-model="m.type" type="enum" jtype="1" :jv="dims.FEEDBACK_TYPE" name="反馈类型" br />
      <sa-item v-model="m.img" type="img-list" name="反馈图" br />
      <sa-item v-model="m.note" type="textarea" name="备注信息" br />
    </el-form>
  </div>
</div>
</template>

<script>
export default {
  name: 'source-feedback',
  props: {
    param: Object
  },
  data() {
    return {
      // 超级对象
      m: this.createModel(),
      dims: sa.$sys.getCurd(),
    }
  },
  methods: {
    createModel() {
      return {
        id: this.param.item.id,
        resourceId: this.param.item.resourceId,
        source: this.param.item.source,
        type: this.param.item.type,
        img: this.param.item.img,
        note: this.param.item.note
      }
    },
    // 变更
    ok: function () {
      // 表单校验
      let m = this.m;
      sa.checkNull(m.type, '请选择反馈类型');
      // 资源反馈
      sa.ajax('/feedback', m, function (res) {
        if (res.code == 200) {
          sa.alert(res.msg, function () {
            this.m = this.createModel();
            sa.closeModel();
            sa.f5()
          }.bind(this));
        }
      }.bind(this), {
        type: 'post'
      });
    },
  }
}
</script>

<style scoped>
.alert-span {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 0px;
  width: 100%;
  height: 40px;
  color: #00549e;
  font-size: medium;
  font-weight: 500;
  background: #f1f1f1;
  border-radius: 5px;

}

.face-back {
  display: flex;
  justify-content: start;
  align-items: center;
  flex-direction: column;
}

.c-item {
  display: flex;
  justify-content: start;
  align-items: center;
  text-align: center;
  width: 100%;
}
</style>
